package com.ytjj.qmyx.mall.controller;

import com.ytjj.common.api.CommonResult;
import com.ytjj.common.controller.BaseController;
import com.ytjj.common.service.RedisService;
import com.ytjj.qmyx.mall.service.HelpWorkInfoService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Random;

/**
 * 
 * 
 * @description: 1元秒杀iPhone13活动相关
 */
@RestController
@RequestMapping("/helpWorkInfo")
@Slf4j
public class HelpWorkInfoController extends BaseController {

    @Autowired
    HelpWorkInfoService helpWorkInfoService;

    @Autowired
    RedisService redisService;

    /**
    * 获取当前用户的助力单详情
    * @param :
    * @returns: com.ytjj.common.api.CommonResult
    * 
    */
    @GetMapping("/getHelpInfo")
    public CommonResult getHelpInfo(){
        return CommonResult.success(helpWorkInfoService.getInfoList());
    }

    /**
     * 给Ta助力
     * @param :
     * @returns: com.ytjj.common.api.CommonResult
     * 
     */
    @GetMapping("/helpThem")
    public CommonResult helpThem(Integer helpWorkId){
        return CommonResult.success(helpWorkInfoService.helpThem(helpWorkId));
    }

}
